#include <stdio.h>
#include <string.h>
#define maxstrlen 90

char str[maxstrlen];

int main() {
  int k;
  
  scanf("%d", &k);
  while (k--) {
    scanf("%s", str);
    //printf("%s\n", str);
    printf("%d\n", get_score(str));
  }  
  
  return 0;
}

int get_score(char *s) {
  int is_correct, acc, score;
  
  for (is_correct = 0, acc = 0, score = 0; *s != '\0'; s++) {
    if (*s == 'X') {
      acc = 0;
      is_correct = 0;
      continue;
    }
    
    acc++;
    score += acc;
    if (!is_correct) {
      is_correct = 1;
    }
  }
  
  return score;
}
